
<%@page import="com.tubemostwanted.entity.Category"%>
<%@page import="java.util.List"%>
<%@page import="com.tubemostwanted.entity.Tube"%>
<%
   	List<Tube> listTube = (List<Tube>) request.getAttribute("result");
	Category cate = (Category) request.getAttribute("cate");
	request.setCharacterEncoding("UTF-8");	
	String url = request.getRequestURI();	
	String title = "Edit Playlist Videos - TubeOnFire";
	String description = "Mix something from youtube. Create an video playlist in seconds";
	String keyword = "video clip, youtube, mix clip, tubeonfire.com, tubeonfire, your clip...";
%>
<script type="text/javascript">		
	window.onload = function(){ 		
		$('#sortable').sortable({			
			opacity: 0.6,	
			start: function(event, ui){
				
			},  update: function(event, ui) {		    					
	         	$.get('/admin/category/add_video', {
					tubeId : $(ui.item).attr('id'),
					prevId : $(ui.item).prev().attr('id'),
					nextId : $(ui.item).next().attr('id'),
					categoryAlias : $('#categoryAlias').attr('title')    						
				}, function(data) {			    										    				
					
				});
	        },
			stop : function(event, ui){
				$(ui.item).effect("highlight", {color: '#66CC66'}, 1500);  					
	        }

		});	
		$("#sortable").disableSelection();
		$('.deleteIcon').click(function(e){ 			
		   var id = $(this).attr('id');
		   $.get('/admin/category/remove_video', {
				tubeId : id,			
				categoryAlias : $('#categoryAlias').attr('title') 					
			}, function(data) {
				$('#sortable').find('#' + id).fadeOut(1500);
				$('#sortable').find('#' + id).html(data);				
				$('#sortable').find('#' + id).show().delay(3000).fadeOut();			
				$("#sortable").css('minHeight',($("#sortable").height()- 20) + 'px');
			});
		});			
	}
</script>	
<jsp:include page="/element/header.jsp">	
	<jsp:param name="url" value="<%= url %>"/>
	<jsp:param name="title" value="<%=title %>"/>	
	<jsp:param name="keywords" value="<%=keyword %>"/>
	<jsp:param name="description" value="<%=description %>"/>
</jsp:include>
<div class="clear"></div>    
<section id="wrapper">		
	<div class="column-full">
	<br />        	
		<div class="page_wrap">
		<div class="page_container box_alignleft sidebox">
			<div class="one" style="margin:5px 5px;">
				<h2 class="title-line alignright">Managing <%= cate.getTitle().getValue()%></h2>
				<br> <br> 												
				<div class="formul">
						 <div class="tbhead"><h5><%=cate.getTitle().getValue() %></h5></div>
						
						<table id="categoryAlias" title="<%=cate.getAlias() %>" cellpadding="0" cellspacing="0" width="100%" class="tableStatic">						
						    <thead>						
						        <tr>						
									<td width="5%">Cover</td>
									<td width="64%">Title</td>									
									<td width="31%">Options</td>		
								</tr>
						
							</thead>
						
						    <tbody id="sortable">
						
							<%
								if(listTube.size()>0){
									for(Tube tub: listTube){										
							%>
							<tr id="<%=tub.getTubeId() %>">		
								<td>
									<a href="/video/<%=tub.getTubeId() %>/<%=tub.getAlias().getValue() %>.html">
										<img src="<%=tub.getThumbImageUrl().getValue() %>" width="60" heaight="40">
									</a>
								</td>
								<td>
									<p>
										<%=tub.getTitle().getValue() %>
									</p>														
								</td>																		
								<td>
									<span style="display: inline;">	
										<div style="float: left;">
											<a href="/admin/video/edit?id=<%=tub.getTubeId() %>" title="Edit video" class="button red icon pencilangled">Edit video</a>
										</div>																			
										<div style="float: right;" class="deleteIcon" id="<%=tub.getTubeId()%>">						
											<p title="Are you sure you want to delete this video?" class="button red on icon delete">Remove</p>
										</div>
									</span>
							 	</td>								
							</tr>						
						<%
							}
									}
							
							%>																			
							</tbody>						
						</table> 
						</div>
				<br>
				  						
				</div>
			</div>
			
<div class="page_sidebox box_alignfull">

</div>
<!-- end pv-sidebox --></div>
</div>
<div class="clear"></div>

<jsp:include page="/element/advertising_right02.jsp"/>	
<jsp:include page="/element/footer.jsp"/>	
			
		
		






